﻿using System;
using System.ComponentModel;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;

namespace Desktop.Controls
{
    /// <summary>
    /// Interaction logic for GlassButton.xaml
    /// </summary>
    public partial class GlassButton : Button, INotifyPropertyChanged
    {
        #region Events

        public event PropertyChangedEventHandler PropertyChanged;

        #endregion

        #region Constructors

        public GlassButton()
        {
            InitializeComponent();
        }

        #endregion

        #region Properties

        public string Text
        {
            get
            {
                return (string)GetValue(TextProperty);
            }
            set
            {
                if (string.IsNullOrEmpty(value))
                {
                    value = string.Empty;
                }
                if (Text != value)
                {
                    SetValue(TextProperty, value);
                    if (PropertyChanged != null)
                    {
                        PropertyChanged(this, new PropertyChangedEventArgs("Text"));
                    }
                }
            }
        }

        public static readonly DependencyProperty TextProperty =
            DependencyProperty.Register("Text", typeof(string), typeof(GlassButton), new PropertyMetadata(string.Empty));

        public ImageSource ImageSource
        {
            get
            {
                return (ImageSource)GetValue(ImageSourceProperty);
            }
            set
            {
                if (ImageSource != value)
                {
                    SetValue(ImageSourceProperty, value);
                    if (PropertyChanged != null)
                    {
                        PropertyChanged(this, new PropertyChangedEventArgs("ImageSource"));
                    }
                }
            }
        }

        public static readonly DependencyProperty ImageSourceProperty =
            DependencyProperty.Register("ImageSource", typeof(ImageSource), typeof(GlassButton), new PropertyMetadata(null));

        #endregion
    }
}